<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
<div class="container-div">
    <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
        <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="module:redWelfareBag:add">
            <i class="fa fa-plus"></i> 添加
        </a>
       <!-- <a class="btn btn-success" onclick="redWelfareBagUser()" shiro:hasPermission="module:redWelfareBag:add">
            <i class="fa fa-plus"></i> 领取记录
        </a>-->
    </div>

    <div class="col-sm-12 select-table table-striped">
        <table id="bootstrap-table" data-mobile-responsive="true"></table>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "module/redWelfareBag";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            modalName: "福利包",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: ''
                },
                {
                    field: 'beginTime',
                    title: '开始时间'
                },
                {
                    field: 'endTime',
                    title: '结束时间'
                },
                {
                    field: 'bagNum',
                    title: '红包数量'
                },
                {
                    field: 'bagMoney',
                    title: '红包金额'
                },
                {
                    field: 'bagTime',
                    title: '发包时间'
                },
                {
                    field: 'createTime',
                    title: '创建时间'
                }
            ]
        };
        $.table.init(options);
    });

    // 领取记录
    function redWelfareBagUser() {
        var id = $.common.isEmpty($.table._option.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns($.table._option.uniqueId);
        if (id.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        alert(id[0]);
        var url = prefix + '/record/' + id[0];
        createMenuItem(url, "福利领取记录");
    }

</script>
</body>
</html>